package jdsk.iria;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class FluencyActivity extends Activity {
	
	private static String studentName;
	private static String fileName;
	private static String teacherName;
	private static String notes;
	private static String spinner1;
	private static String spinner2;
	private static String spinner3;
	private int countOfGestures;
	private int numOfWords;
	private String CB;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fluency);
        
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
           studentName = extras.getString("studentName");
           teacherName = extras.getString("teacherName");
           fileName = extras.getString("fileName");
           notes = extras.getString("notes");
           countOfGestures = extras.getInt("countOfGestures");
           numOfWords = extras.getInt("numOfWords");
           CB = extras.getString("CB");
        }
        
        //Spinner code for spinner 1
        String[] expressionList = new String[] {"(None)", "Reads with minimal expression or enthusiasm", "Some expression or enthusiasm", "Good expression and enthusiasm. Varis expression to match interpretation of the text"};
        Spinner spinner = (Spinner) findViewById(R.id.spinner1);      
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, expressionList);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        
        //Spinner code for spinner 2
        String[] psList = new String[] {"(None)", "Mostly word-by-word reading; choppy", "Occasional breaks in smoothness; some choppy areas with two and three- word phrasing", "Mostly smooth reading with appropriate phrasing"};
        Spinner spinner2 = (Spinner) findViewById(R.id.spinner2);
        ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, psList);
        adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner2.setAdapter(adapter2);
        
      //Spinner code for spinner 3
        String[] paceList = new String[] {"(None)", "Slow and labored", "Uneven - mixture of fast and slow reading", "Mimics conversational pace; not too fast or slow"};
        Spinner spinner3 = (Spinner) findViewById(R.id.spinner3);
        ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, paceList);
        adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner3.setAdapter(adapter3);
        
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_fluency, menu);
        return true;
    }
    
    public void saveFluencyButtonClick(View view){
    	
    	Spinner mySpinner1 = (Spinner)findViewById(R.id.spinner1);
        spinner1 = mySpinner1.getSelectedItem().toString();
    	Spinner mySpinner2 = (Spinner)findViewById(R.id.spinner2);
    	spinner2 = mySpinner2.getSelectedItem().toString();
    	Spinner mySpinner3 = (Spinner)findViewById(R.id.spinner3);
    	spinner3 = mySpinner3.getSelectedItem().toString();
    	
    	Bundle dataBundle = new Bundle();
	 	dataBundle.putString("fileName", fileName);
	 	dataBundle.putString("studentName",studentName);
	 	dataBundle.putString("teacherName",teacherName);
	 	dataBundle.putString("notes",notes);
	 	dataBundle.putString("spinner1", spinner1);
		dataBundle.putString("spinner2", spinner2);
		dataBundle.putString("spinner3", spinner3);
	 	dataBundle.putString("CB",CB);
	 	dataBundle.putInt("countOfGestures", countOfGestures);
	 	dataBundle.putInt("numOfWords", numOfWords);
    	Intent myIntent = new Intent(this, StatsActivity.class);
    	myIntent.putExtras(dataBundle);
    	this.startActivity(myIntent);
    }

    
}
